package ThreadPoolTest;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

public class RedisDlqDiscardPolicy implements RejectedExecutionHandler {
    private final RedisDlqManager dlqManager;

    public RedisDlqDiscardPolicy(RedisDlqManager redisDlqManager) {
        this.dlqManager = redisDlqManager;
    }

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {

        this.dlqManager.addTask(r);//将redis信息存入redis

    }
}
